package com.itany.ums.service.impl;

import com.itany.ums.dao.UserDao;
import com.itany.ums.entity.User;
import com.itany.ums.service.UserService;
import com.itany.ums.util.MybatisUtil;

/**
 * Author：汤小洋
 * Date：2022-11-21 16:39
 * Description：<描述>
 */
public class UserServiceImpl implements UserService {

    private UserDao userDao;

    @Override
    public void register(User user) {
        try {
            userDao = MybatisUtil.getSession().getMapper(UserDao.class);
            userDao.insert(user);
            MybatisUtil.getSession().commit();
        } catch (Exception e) {
            MybatisUtil.getSession().rollback();
            e.printStackTrace();
        } finally {
            MybatisUtil.close();
        }


    }
}
